from rest_framework import serializers

from apps.areas.models import Area

#获取省级地区序列化器
class AreaInfoSerializer(serializers.ModelSerializer):

    class Meta:
        model=Area
        fields=['id','name']


class AreaSubsInfoSerializer(serializers.ModelSerializer):

    subs=AreaInfoSerializer(read_only=True,many=True)

    class Meta:
        model=Area
        fields=['id','name','subs']